<template>
  <div id="app">
    <Navigator :title="pageTitle" :left-arrow="leftArrow" @click-left="handleClickLeft" />
    <router-view />
  </div>
</template>

<script>
import Navigator from './components/Navigator.vue';

export default {
  name: 'App',
  components: {
    Navigator
  },
  data() {
    return {
      pageTitle: '首页',
      leftArrow: false
    }
  },
  watch: {
    $route(to) {
      this.pageTitle = to.name;
      this.leftArrow = to.path !== '/';
    }
  },
  methods: {
    handleClickLeft() {
      this.$router.back();
    }
  }
}
</script>

<style>
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
}
</style>
